#include <iostream>
using namespace std;

int main (void)
{
  int num = 6;
  int count = 0;
  
  for(int a = 1; a <= num; ++a)
  {
    for(int b = 1; b <= num; ++b)
    {
      if (b == a) continue;
      for(int c =1; c <= num; ++c)
      {
        if (c == b | c == a) continue;
        for(int d =1; d <= num; ++d)
        {
          if (d == c | d == b | d == a) continue;
          for(int e = 1; e <= num; ++e)
          {
            if (e == d |e == c | e== b | e == a) continue;
            for(int f =1 ; f <= num; ++f)
            {
              if (f==e | f == d |f == c | f== b | f == a) continue;
              cout << a << b << c << d << e << f << endl;
              count++;
            }
          }
        }
      }
    }
  }
  cout << "total number: " << count << endl;
}
